package com.ysz.component.conf;

import com.ysz.component.constant.MyBatisConst;
import com.ysz.component.encrypt.MyBatisEncryptInterceptor;
import org.apache.ibatis.plugin.Interceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;

/**
 * @ClassName MyBatisEncryptInterceptorConfig
 * @Description TODO
 * @Data 14:20
 * @Version 1.0
 * @Author ysz
 */
@Configuration
public class MyBatisEncryptInterceptorConfig {

    @Bean
    public Interceptor getEncryptInterceptor() {
        Properties properties = new Properties();
        properties.setProperty(MyBatisConst.sql_result_encrypt.getKey(), MyBatisConst.sql_result_encrypt_enable.getValue());
        MyBatisEncryptInterceptor myBatisEncryptInterceptor = new MyBatisEncryptInterceptor();
        myBatisEncryptInterceptor.setProperties(properties);
        return myBatisEncryptInterceptor;
    }
}
